using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using System.Text;
using ECommerce.DAL;

namespace Entity
{
	/// <summary>
	/// This object represents the Private Fields of TblFreeRestringingForm.
	/// </summary>
	
	[System.ComponentModel.DataObject]
    public class TblFreeRestringingForm : DatabaseUtility
    {
		#region TblFreeRestringingForm Private Fields


		Int32 _formId;
		DateTime _formDate;
		String _userName = String.Empty;
		String _userAddress = String.Empty;
		String _userTelephoneNumber = String.Empty;
		String _userEmailAddress = String.Empty;
		String _lengthOfNecklace = String.Empty;
		String _totalPearls = String.Empty;
		String _sizeOfPearls = String.Empty;
		Boolean _isKnotted;
		String _comments = String.Empty;
		DateTime _createDate;
		
		#endregion
		#region TblFreeRestringingForm Constractor
		/// <summary>
        /// Creates an empty object of TblFreeRestringingForm. 
        /// This is mainly used to create a new instance of TblFreeRestringingForm to add a new TblFreeRestringingForm.
        /// </summary>
		public TblFreeRestringingForm(){}
		
				
		/// <summary>
        /// Used to retrieve employee information from database, 
        /// which is also used by Update method to save information of an existing TblFreeRestringingForm.
        /// </summary>
		public TblFreeRestringingForm
		(
			Int32 formId,
			DateTime formDate,
			String userName,
			String userAddress,
			String userTelephoneNumber,
			String userEmailAddress,
			String lengthOfNecklace,
			String totalPearls,
			String sizeOfPearls,
			Boolean isKnotted,
			String comments,
			DateTime createDate
		)
		{
			_formId = formId;	
			_formDate = formDate;	
			_userName = userName;	
			_userAddress = userAddress;	
			_userTelephoneNumber = userTelephoneNumber;	
			_userEmailAddress = userEmailAddress;	
			_lengthOfNecklace = lengthOfNecklace;	
			_totalPearls = totalPearls;	
			_sizeOfPearls = sizeOfPearls;	
			_isKnotted = isKnotted;	
			_comments = comments;	
			_createDate = createDate;	
		}
		
		#endregion
		#region TblFreeRestringingForm Properties
		
		 /***********************************************************************************************
                                    -- PROPERTIES --        
         Contains all the properties representing the data fields of the current entity.
         ***********************************************************************************************/

        /// <summary>
        /// This is the Primary key value of the FormId, which can't be assigned from the application,
        /// to ensure the data consistancy, by not letting the user to change the PK_TblFreeRestringingForm to update the data of an another TblFreeRestringingForm instance.
        /// For view or updation purpose, every TblFreeRestringingForm will be retrieved thru the proper 'Get' method.
        /// </summary>
		
		public Int32 FormId
		{
			get {return _formId;}	
		}
		
				
		public DateTime FormDate
		{
			get {return _formDate;}
			set {_formDate = value;}
		}

		public String UserName
		{
			get {return _userName;}
			set {_userName = value;}
		}

		public String UserAddress
		{
			get {return _userAddress;}
			set {_userAddress = value;}
		}

		public String UserTelephoneNumber
		{
			get {return _userTelephoneNumber;}
			set {_userTelephoneNumber = value;}
		}

		public String UserEmailAddress
		{
			get {return _userEmailAddress;}
			set {_userEmailAddress = value;}
		}

		public String LengthOfNecklace
		{
			get {return _lengthOfNecklace;}
			set {_lengthOfNecklace = value;}
		}

		public String TotalPearls
		{
			get {return _totalPearls;}
			set {_totalPearls = value;}
		}

		public String SizeOfPearls
		{
			get {return _sizeOfPearls;}
			set {_sizeOfPearls = value;}
		}

		public Boolean IsKnotted
		{
			get {return _isKnotted;}
			set {_isKnotted = value;}
		}

		public String Comments
		{
			get {return _comments;}
			set {_comments = value;}
		}

		public DateTime CreateDate
		{
			get {return _createDate;}
			set {_createDate = value;}
		}
		

		#endregion
		#region TblFreeRestringingForm Static Methods
		/************************************************************************************
                                    -- CREATE METHOD (STATIC) --
        *************************************************************************************/
		/************************* Architecure note:**********************************
        Note 1:
        This method is specially useful for the case, where we need to use Object Data Source controls.
        For ObjectDataSource/SqlDataSource controls, the insert/update metnod requires paramters methods, rather property based methods.
        However, there is still a way to pass property based objects as method parameter for data source controls, 
        but in that case we could not use Sql type, as view controls or asp parameter control can only contain few of primitive type.
        The main reason to remain the Sql Type in our object architecture is it is faster and contains better way for null value support.
        
        Note 2: 
        Non-primary key: it should be primitive type, as the asp paramter control (included in data source control) supports only primitive types.
        /*****************************************************************************/
		[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]
        public static  Int32 CreateNewTblFreeRestringingForm
		(
			DateTime formDate,
			String userName,
			String userAddress,
			String userTelephoneNumber,
			String userEmailAddress,
			String lengthOfNecklace,
			String totalPearls,
			String sizeOfPearls,
			Boolean isKnotted,
			String comments,
			DateTime createDate
		)
		{
			//creating an empty TblFreeRestringingForm object
            TblFreeRestringingForm tblFreeRestringingForm = new TblFreeRestringingForm();
				tblFreeRestringingForm.FormDate = formDate;
				tblFreeRestringingForm.UserName = userName;
				tblFreeRestringingForm.UserAddress = userAddress;
				tblFreeRestringingForm.UserTelephoneNumber = userTelephoneNumber;
				tblFreeRestringingForm.UserEmailAddress = userEmailAddress;
				tblFreeRestringingForm.LengthOfNecklace = lengthOfNecklace;
				tblFreeRestringingForm.TotalPearls = totalPearls;
				tblFreeRestringingForm.SizeOfPearls = sizeOfPearls;
				tblFreeRestringingForm.IsKnotted = isKnotted;
				tblFreeRestringingForm.Comments = comments;
				tblFreeRestringingForm.CreateDate = createDate;
			
			return TblFreeRestringingForm.CreateNewTblFreeRestringingForm(tblFreeRestringingForm);
		}
	
		/************************************************************************************
                 -- UPDATE METHODS (STATIC) --
        *************************************************************************************/

        /************************* Architecure note:**********************************
        Note 1:
        This method is specially useful for the case, where we need to use Object Data Source controls.
        For ObjectDataSource/SqlDataSource controls, the insert/update metnod requires paramters methods, rather property based methods.
        However, there is still a way to pass property based objects as method parameter for data source controls, 
        but in that case we could not use Sql type, as view controls or asp parameter control can only contain few of primitive type.
        The main reason to remain the Sql Type in our object architecture is it is faster and contains better way for null value support.
        
        Note 2: 
        There the two types of paramaters will be passed here.
         * a. Primary key paramater: it should be Sql type, as we will bind the primary key property for the view controls (form view, details view etc) as datakey.
         * b. Non-primary key: it should be primitive type, as the asp paramter control (included in data source control) supports only primitive types.
        /*****************************************************************************/
		
		[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
        public static  bool UpdateTblFreeRestringingForm
		(
			Int32 formId,
			DateTime formDate,
			String userName,
			String userAddress,
			String userTelephoneNumber,
			String userEmailAddress,
			String lengthOfNecklace,
			String totalPearls,
			String sizeOfPearls,
			Boolean isKnotted,
			String comments,
			DateTime createDate
		)
		{
			 TblFreeRestringingForm tblFreeRestringingForm =  TblFreeRestringingForm.GetTblFreeRestringingFormByFormId(formId);
			
				tblFreeRestringingForm.FormDate = formDate;
				tblFreeRestringingForm.UserName = userName;
				tblFreeRestringingForm.UserAddress = userAddress;
				tblFreeRestringingForm.UserTelephoneNumber = userTelephoneNumber;
				tblFreeRestringingForm.UserEmailAddress = userEmailAddress;
				tblFreeRestringingForm.LengthOfNecklace = lengthOfNecklace;
				tblFreeRestringingForm.TotalPearls = totalPearls;
				tblFreeRestringingForm.SizeOfPearls = sizeOfPearls;
				tblFreeRestringingForm.IsKnotted = isKnotted;
				tblFreeRestringingForm.Comments = comments;
				tblFreeRestringingForm.CreateDate = createDate;
			
			return TblFreeRestringingForm.UpdateTblFreeRestringingForm(tblFreeRestringingForm);
		}

		/************************************************************************************
                         -- DELETE METHODS --
        *************************************************************************************/
        /************************* Architecure note:**********************************
        We have used the employeeId parameter as SqlInt32, to bind the delete method with object data source and view control directly.
        ****************************************************************************/
		[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
        public static  bool DeleteTblFreeRestringingForm
		(
			Int32 formId
		)
		{
			//Validate Input
			if(formId <= GetFormIdMinValue)
				throw (new ArgumentOutOfRangeException("formId"));
				
			// Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
			AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
			AddParameterToSqlCmd(sqlCmd, "@FormId",SqlDbType.Int, 0, ParameterDirection.Input, formId);
			SetCommandType(sqlCmd,CommandType.StoredProcedure,SPR_TBLFREERESTRINGINGFORM_DELETETBLFREERESTRINGINGFORM);
			ExecuteScalarCmd(sqlCmd);
			int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
			return (returnValue == 0 ? false : true);
			
		}
		
		/// <summary>
        /// Deletes a set of employees from the database.
        /// </summary>
		public static bool DeleteTblFreeRestringingFormList( System.Collections.Generic.List<Int32>  formIdListToDelete)
		{
			//Validate Input
			foreach (Int32 formId in formIdListToDelete)
			    if(formId <= GetFormIdMinValue)
					throw (new ArgumentOutOfRangeException("formId"));
			
			//performing deletion operation //

            string xmlString = FormatXMLForIdArray(formIdListToDelete);
			
			// Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
			AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
            AddParameterToSqlCmd(sqlCmd, "@FormIdList", SqlDbType.Xml, xmlString.ToString().Length, ParameterDirection.Input, xmlString.ToString());
			SetCommandType(sqlCmd,CommandType.StoredProcedure,SPR_TBLFREERESTRINGINGFORM_DELETETBLFREERESTRINGINGFORMLIST);
			ExecuteScalarCmd(sqlCmd);
			int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
			return (returnValue == formIdListToDelete.Count ? true : false);
		}
		
		/************************************************************************************
                                 -- GET BY PRIMARY METHODS --
        *************************************************************************************/
        /************************* Architecure note:**********************************
        Retrives an Employee from database, based on it's primary key.
        To view or update an employee, everytime we must have to use this type of 'get' method, 
        since we don't have direct access to the Primary key value for assigning value.
        We have used the employeeId parameter as SqlInt32, to bind the delete method with object data source and view control directly.
        /*****************************************************************************/
		[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
		public static TblFreeRestringingForm GetTblFreeRestringingFormByFormId(Int32 formId)
		{
			if(formId <= GetFormIdMinValue)
					throw (new ArgumentOutOfRangeException("formId"));
				
		 	// Execute SQL Command
			SqlCommand sqlCmd = new SqlCommand();
			AddParameterToSqlCmd(sqlCmd, "@FormId",SqlDbType.Int, 0, ParameterDirection.Input, formId);
			SetCommandType(sqlCmd,CommandType.StoredProcedure,SPR_TBLFREERESTRINGINGFORM_GETTBLFREERESTRINGINGFORMBYFORMID);
			GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblFreeRestringingFormCollectionFromReader);
            CustomCollection<TblFreeRestringingForm> objCollection = ((CustomCollection<TblFreeRestringingForm>)ExecuteReaderCmd(sqlCmd, test));

            if (objCollection.Count > 0)
                return objCollection[0];
            else
                return null;
		}
		
		/************************************************************************************
                         -- GET BY FOREIGN KEY METHODS --
        *************************************************************************************/
		
		/************************************************************************************
                 -- GET ALL METHODS --
        *************************************************************************************/
		[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public static CustomCollection<TblFreeRestringingForm> GetAllTblFreeRestringingForm()
		{
		
		 	// Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            SetCommandType(sqlCmd,CommandType.StoredProcedure,SPR_TBLFREERESTRINGINGFORM_GETALLTBLFREERESTRINGINGFORM);
            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblFreeRestringingFormCollectionFromReader);
            CustomCollection<TblFreeRestringingForm> objCollection = ((CustomCollection<TblFreeRestringingForm>)ExecuteReaderCmd(sqlCmd, test));

            return objCollection;
		}
		
		[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public static CustomCollection<TblFreeRestringingForm> GetAllTblFreeRestringingFormPaged(String orderBy, Int32 startRowIndex, Int32 maximumRows)
        {
            //Validate Input
            if (orderBy == "")
                orderBy = "FormId";

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@orderby", SqlDbType.VarChar, 50, ParameterDirection.Input, orderBy);
            AddParameterToSqlCmd(sqlCmd, "@startrow", SqlDbType.Int, 0, ParameterDirection.Input, startRowIndex);
            AddParameterToSqlCmd(sqlCmd, "@pagesize", SqlDbType.Int, 0, ParameterDirection.Input, maximumRows);

            SetCommandType(sqlCmd,CommandType.StoredProcedure,SPR_TBLFREERESTRINGINGFORM_GETALLTBLFREERESTRINGINGFORMPAGED);

            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblFreeRestringingFormCollectionFromReader);
            CustomCollection<TblFreeRestringingForm> objCollection = ((CustomCollection<TblFreeRestringingForm>)ExecuteReaderCmd(sqlCmd, test));
            return objCollection;
        }
		
		[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public static int GetAllTblFreeRestringingFormPagedCount(String orderBy, Int32 startRowIndex, Int32 maximumRows)
        {
            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();

            AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
            SetCommandType(sqlCmd,CommandType.StoredProcedure,SPR_TBLFREERESTRINGINGFORM_GETALLTBLFREERESTRINGINGFORMPAGEDCOUNT);
            ExecuteScalarCmd(sqlCmd);

            int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
            return returnValue;
        }
		
		#endregion
		#region Employee Instance Methods
		/************************************************************************************
                                    -- SAVE (INSERT/UPDATE) METHODS (INSTANCE) --
        *************************************************************************************/
		/// <summary>
        /// Saves (inserts and updates) an Employee into database.
        /// The insertion occur if the EmployeeId conatins default value.
        /// Otherwises it updates the Employee into the database, based on the primary key value stored in EmployeeId.
        /// This technique ensures an Employee will not be updated without having a valid EmployeeId.
        /// </summary>
		public bool Save()
		{
			if(FormId<= GetFormIdMinValue)
			{
				Int32 TempId=CreateNewTblFreeRestringingForm(this);
				if(TempId>0)
				{
					_formId=TempId;
					return true;
				}
				else
				{
					// error occurs
					return false;
				}
			}
			else
			{	//This is a update Command
				return (UpdateTblFreeRestringingForm(this));
			}
			
		}
		
		public static Int32 CreateNewTblFreeRestringingForm(TblFreeRestringingForm newTblFreeRestringingForm)
		{
			// validate Parameters
			if (newTblFreeRestringingForm == null)
				throw (new ArgumentNullException("newTblFreeRestringingForm"));

			// Execute SQL Command
			SqlCommand sqlCmd = new SqlCommand();
			int length = 0;
			AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
            
			AddParameterToSqlCmd(sqlCmd, "@FormDate",SqlDbType.DateTime, 0, ParameterDirection.Input, newTblFreeRestringingForm.FormDate);
			AddParameterToSqlCmd(sqlCmd, "@UserName",SqlDbType.NVarChar, 4000, ParameterDirection.Input, newTblFreeRestringingForm.UserName);
			AddParameterToSqlCmd(sqlCmd, "@UserAddress",SqlDbType.NVarChar, 4000, ParameterDirection.Input, newTblFreeRestringingForm.UserAddress);
			AddParameterToSqlCmd(sqlCmd, "@UserTelephoneNumber",SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblFreeRestringingForm.UserTelephoneNumber);
			AddParameterToSqlCmd(sqlCmd, "@UserEmailAddress",SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblFreeRestringingForm.UserEmailAddress);
			AddParameterToSqlCmd(sqlCmd, "@LengthOfNecklace",SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblFreeRestringingForm.LengthOfNecklace);
			AddParameterToSqlCmd(sqlCmd, "@TotalPearls",SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblFreeRestringingForm.TotalPearls);
			AddParameterToSqlCmd(sqlCmd, "@SizeOfPearls",SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblFreeRestringingForm.SizeOfPearls);
			AddParameterToSqlCmd(sqlCmd, "@IsKnotted",SqlDbType.Bit, 0, ParameterDirection.Input, newTblFreeRestringingForm.IsKnotted);
			AddParameterToSqlCmd(sqlCmd, "@Comments",SqlDbType.Text, 16, ParameterDirection.Input, newTblFreeRestringingForm.Comments);
			AddParameterToSqlCmd(sqlCmd, "@CreateDate",SqlDbType.DateTime, 0, ParameterDirection.Input, newTblFreeRestringingForm.CreateDate);
			
			SetCommandType(sqlCmd,CommandType.StoredProcedure,SPR_TBLFREERESTRINGINGFORM_CREATENEWTBLFREERESTRINGINGFORM);
			ExecuteScalarCmd(sqlCmd);
			return (Int32.Parse(sqlCmd.Parameters["@ReturnValue"].Value.ToString()));

		}
		/// <summary>
        /// Updates an TblFreeRestringingForm instance to the database.
        /// </summary>
		public static bool UpdateTblFreeRestringingForm(TblFreeRestringingForm newTblFreeRestringingForm)
		{
			// validate Parameters
			if (newTblFreeRestringingForm == null)
				throw (new ArgumentNullException("newTblFreeRestringingForm"));

			// Execute SQL Command
			SqlCommand sqlCmd = new SqlCommand();
			int length = 0;
			AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
            
			AddParameterToSqlCmd(sqlCmd, "@FormId",SqlDbType.Int, 0, ParameterDirection.Input, newTblFreeRestringingForm.FormId);
			AddParameterToSqlCmd(sqlCmd, "@FormDate",SqlDbType.DateTime, 0, ParameterDirection.Input, newTblFreeRestringingForm.FormDate);
			AddParameterToSqlCmd(sqlCmd, "@UserName",SqlDbType.NVarChar, 4000, ParameterDirection.Input, newTblFreeRestringingForm.UserName);
			AddParameterToSqlCmd(sqlCmd, "@UserAddress",SqlDbType.NVarChar, 4000, ParameterDirection.Input, newTblFreeRestringingForm.UserAddress);
			AddParameterToSqlCmd(sqlCmd, "@UserTelephoneNumber",SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblFreeRestringingForm.UserTelephoneNumber);
			AddParameterToSqlCmd(sqlCmd, "@UserEmailAddress",SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblFreeRestringingForm.UserEmailAddress);
			AddParameterToSqlCmd(sqlCmd, "@LengthOfNecklace",SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblFreeRestringingForm.LengthOfNecklace);
			AddParameterToSqlCmd(sqlCmd, "@TotalPearls",SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblFreeRestringingForm.TotalPearls);
			AddParameterToSqlCmd(sqlCmd, "@SizeOfPearls",SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblFreeRestringingForm.SizeOfPearls);
			AddParameterToSqlCmd(sqlCmd, "@IsKnotted",SqlDbType.Bit, 0, ParameterDirection.Input, newTblFreeRestringingForm.IsKnotted);
			AddParameterToSqlCmd(sqlCmd, "@Comments",SqlDbType.Text, 16, ParameterDirection.Input, newTblFreeRestringingForm.Comments);
			AddParameterToSqlCmd(sqlCmd, "@CreateDate",SqlDbType.DateTime, 0, ParameterDirection.Input, newTblFreeRestringingForm.CreateDate);
			
			SetCommandType(sqlCmd,CommandType.StoredProcedure,SPR_TBLFREERESTRINGINGFORM_UPDATETBLFREERESTRINGINGFORM);
            ExecuteScalarCmd(sqlCmd);
			int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
			return (returnValue == 0 ? false : true);
		}
		#endregion
		
		#region TblFreeRestringingForm Related Collections
		/// <summary>
        /// Creates and returns a strongly typed collection of Employee custom entity. 
        /// The colelction is created through iterating on the IdataReader object which contains Employee information, as a set of records, similar to tabular format.
        /// </summary>
		public static CollectionBase  GenerateTblFreeRestringingFormCollectionFromReader(IDataReader returnData) 
		{
			
			//creating the instance of Employee collection
			CustomCollection<TblFreeRestringingForm> colTblFreeRestringingForm = new CustomCollection<TblFreeRestringingForm>();
			
			/************************* Architecure note:**********************************
             * Below code includes the null value functionality to retieve the data which has nill value in database end.
             * Design consideration:
             * Besides general data fields, special care should be taken for primary keys, to assign '0'/defaultvalue, rather passing 'Null' value in constructor parameter.
             * Although we are considering sqldb tyoe data for the current data container, but while retireving data from database end, through datareader object, we need to cast data reader objects using .net primitive data type, 
             * rather using sqldb type to cast, since data reader objects don't support sql db type to be casted.
             *****************************************************************************/

            //Iterating thriugh the data reader, to generate Employee collection.

			//getting the Employee collection by iterating thru the data reader
			while (returnData.Read()) 
			{
				//passing the TblFreeRestringingForm constructor parameters from the current instance of data reader fields.
				TblFreeRestringingForm newTblFreeRestringingForm = new TblFreeRestringingForm
				(
					returnData["FormId"]== System.DBNull.Value ? GetFormIdMinValue : (Int32 ) returnData["FormId"],
					returnData["FormDate"]== System.DBNull.Value ? DateTime.MinValue: (DateTime ) returnData["FormDate"],
					returnData["UserName"]== System.DBNull.Value ? string.Empty: (String ) returnData["UserName"],
					returnData["UserAddress"]== System.DBNull.Value ? string.Empty: (String ) returnData["UserAddress"],
					returnData["UserTelephoneNumber"]== System.DBNull.Value ? string.Empty: (String ) returnData["UserTelephoneNumber"],
					returnData["UserEmailAddress"]== System.DBNull.Value ? string.Empty: (String ) returnData["UserEmailAddress"],
					returnData["LengthOfNecklace"]== System.DBNull.Value ? string.Empty: (String ) returnData["LengthOfNecklace"],
					returnData["TotalPearls"]== System.DBNull.Value ? string.Empty: (String ) returnData["TotalPearls"],
					returnData["SizeOfPearls"]== System.DBNull.Value ? string.Empty: (String ) returnData["SizeOfPearls"],
					returnData["IsKnotted"]== System.DBNull.Value ? false: (Boolean ) returnData["IsKnotted"],
					returnData["Comments"]== System.DBNull.Value ? null: (String ) returnData["Comments"],
					returnData["CreateDate"]== System.DBNull.Value ? DateTime.MinValue: (DateTime ) returnData["CreateDate"]

				);
				//adding the Employee to the collection
				colTblFreeRestringingForm.Add(newTblFreeRestringingForm);
			}
			
			//returns the collection of Companys 
			return (colTblFreeRestringingForm);
		}
		
		#endregion
		#region Constants and Default Values
		
		public static Int32 GetFormIdMinValue
		{
			get
			{
				return 0;
			}
		}
		
		//create method related contants
			internal const string SPR_TBLFREERESTRINGINGFORM_CREATENEWTBLFREERESTRINGINGFORM="spr_TblFreeRestringingForm_CreateNewTblFreeRestringingForm";
			internal const string SPR_TBLFREERESTRINGINGFORM_UPDATETBLFREERESTRINGINGFORM="spr_TblFreeRestringingForm_UpdateTblFreeRestringingForm";
			internal const string SPR_TBLFREERESTRINGINGFORM_DELETETBLFREERESTRINGINGFORM="spr_TblFreeRestringingForm_DeleteTblFreeRestringingForm";
			internal const string SPR_TBLFREERESTRINGINGFORM_DELETETBLFREERESTRINGINGFORMLIST="spr_TblFreeRestringingForm_DeleteTblFreeRestringingFormList";
			internal const string SPR_TBLFREERESTRINGINGFORM_GETTBLFREERESTRINGINGFORMBYFORMID="spr_TblFreeRestringingForm_GetTblFreeRestringingFormByFormId";
			internal const string SPR_TBLFREERESTRINGINGFORM_GETALLTBLFREERESTRINGINGFORM="spr_TblFreeRestringingForm_GetAllTblFreeRestringingForm";
			internal const string SPR_TBLFREERESTRINGINGFORM_GETALLTBLFREERESTRINGINGFORMPAGED="spr_TblFreeRestringingForm_GetAllTblFreeRestringingFormPaged";
			internal const string SPR_TBLFREERESTRINGINGFORM_GETALLTBLFREERESTRINGINGFORMPAGEDCOUNT="spr_TblFreeRestringingForm_GetAllTblFreeRestringingFormPagedCount";
		
		#endregion
	}
}	
